using Microsoft.EntityFrameworkCore;
using UniversalAdmin.Domain.Entities;
using UniversalAdmin.Domain.Repositories;
using UniversalAdmin.Infrastructure.Data;

namespace UniversalAdmin.Infrastructure.Repositories;

public class ArticleCategoryRepository : BaseRepository<ArticleCategory>, IArticleCategoryRepository
{
  public ArticleCategoryRepository(UniversalAdminDbContext context) : base(context) { }

  public async Task<IEnumerable<ArticleCategory>> GetAllActiveAsync()
  {
    return await _context.ArticleCategories
        .Where(c => c.IsActive)
        .OrderBy(c => c.Sort)
        .ToListAsync();
  }
}